use anyhow::{Result, Context};
use reqwest;

/// A basic demonstration exploit that checks if a specific endpoint is "vulnerable"
pub async fn run(target: &str) -> Result<()> {
    println!("[*] Running sample_exploit against target: {}", target);

    let url = format!("http://{}/vulnerable_endpoint", target);
    let resp = reqwest::get(&url)
        .await
        .context("Failed to send request")?
        .text()
        .await
        .context("Failed to read response")?;

    if resp.contains("Vulnerable!") {
        println!("[+] Target is vulnerable!");
    } else {
        println!("[-] Target does not appear to be vulnerable.");
    }

    Ok(())
}
